#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<malloc.h>
#include "../include/meta.h"
#include "../include/vfs_errorcodes.h"
char* dirpath,*foldername;

char* createdir (char* path, char* folder)
{
	
	
	int l;
	printf("path1:%s\n",path);
	printf("%s\n",root->data);
	char *path1;
	//path1=path;
	strcpy(path1,path);
	printf("path1:%s\n",path1);
	if(ifexists(path1,root,folder) == 1)
	{
		return ERR_VFS_MAKEDIR_03;
	}
	//displayTree(root);
	//printf("b4 %s\n",path);
	int i;
	//str a[0]=
	//printf("Readddddddddched %s",a);
	//strcat(path,a);
	printf("Reached %s\n",path);
	//strcat(path,folder);
	printf("Reached %s\n",path);
	//strcpy(dirpath,path);
	//strcpy(foldername,folder);
	printf("Reached %s\n",path);
	//insertIntoTree(dirpath,root,1);
	
	
		return "makedir_SUCCESS";
	
}

int getDirIndex()
{
	int i;
	for(i=0;i<300;i++)
	{
			
	
		
		if(fl[i].a == 0)
		{
		//	l=i;
			fl[i].a = 1;
			strcpy(fd[i].location_path,dirpath);
			strcpy(fd[i].file_name,foldername);
			strcpy(fd[i].file_type,"folder");
			fd[i].block_number = 0 ;
			fd[i].file_size = 0; 
			main_header_var->no_used_file_descriptors=main_header_var->no_used_file_descriptors+1;
			//insertIntoTree(path,root,i);
			//displayTree(root);
			//printf("%d\n");
			break;
		}
		
	}
	return i;
}



